//
//  FamilyOptionView.m
//  AILock
//
//  Created by 谭亚明 on 2020/6/29.
//  Copyright © 2020 tym. All rights reserved.
//

#import "FamilyOptionView.h"
#import "UIView+ZFFrame.h"
#import "Sizes.h"
@interface FamilyOptionView ()

@property(nonatomic,weak) IBOutlet UIView  *conView;


@end

@implementation FamilyOptionView

+(void)showOptionViewCompletion:(void(^)( NSInteger otionType))completion{
    
    FamilyOptionView *view = [[[NSBundle mainBundle] loadNibNamed:@"FamilyOptionView" owner:self options:nil] lastObject];
    view.frame = CGRectMake(0, 0,ScreenWidth, ScreenHeight);
    view.optionBlack = completion;
    [[UIApplication sharedApplication].windows.firstObject addSubview:view];
}

-(void)layoutSubviews{
    self.conView.zf_width = ScreenWidth;
    [self.conView showTopCircularDead];
}

-(void)awakeFromNib{
    [super awakeFromNib];
    
    self.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.4];
    
}

-(IBAction)sureAction:(id)sender{
    
    if (self.optionBlack) {
        self.optionBlack(5);
    }
    [self removeFromSuperview];
}

-(IBAction)refuseAction:(id)sender{
    if (self.optionBlack) {
        self.optionBlack(6);
    }
    [self removeFromSuperview];
}

-(IBAction)joinBlackAction:(id)sender{
    
    if (self.optionBlack) {
        self.optionBlack(7);
    }
    
    [self removeFromSuperview];
}

-(IBAction)cancelAction:(id)sender{
    
    [self removeFromSuperview];
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
